package asteroids.entity.equipment;

import asteroids.engine.Utils;
import asteroids.entity.Ship;

public abstract class Exhaust
{
    protected Ship ship;
    protected Utils.PolarCoordinate relativePosition;

    // add direction parameter for CompositeShips?
    public Exhaust(Ship ship, Utils.PolarCoordinate relativePosition)
    {
        this.ship = ship;
        this.relativePosition = relativePosition;
    }

    /**
     * make a guess as to where the exhaust port will be located.
     * 
     * @param ship
     */
    public Exhaust(Ship ship)
    {
        this(ship, Utils.createPolarCoordinate(180, ship.getMaxRadius() * (2d / 3)));
    }

    /**
     * call this every time you want to make exhaust particles to find exactly
     * where to put them.
     * 
     * @return
     */
    public Utils.CartesianCoordinate getExhaustLocation()
    {
        return Utils.cartesianFromPolar(relativePosition.rotateBy(ship.getRotation())).shiftBy(
                ship.getXPosition(), ship.getYPosition());
    }

    public abstract void vroom();
}
